const arrayWithAllFruitsAsvalues = ['apple', 'peach'] as const; type Fruit = typeof arrayWithAllFruitsAsvalues[number]; // "apple" | "peach" const objectWithAllFruitsAsKeys: { [ key in Fruit ]: any } = { apple: '', peach: '' }